import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BuildingFloorRoomVO, BuildingFloorRoomForm, BuildingFloorRoomQuery } from '@/api/dormitory/buildingFloorRoom/types';

/**
 * 查询宿舍楼-楼层-宿舍列表
 * @param query
 * @returns {*}
 */

export const listBuildingFloorRoom = (query?: BuildingFloorRoomQuery): AxiosPromise<BuildingFloorRoomVO[]> => {
  return request({
    url: '/dormitory/buildingFloorRoom/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询宿舍楼-楼层-宿舍详细
 * @param id
 */
export const getBuildingFloorRoom = (id: string | number): AxiosPromise<BuildingFloorRoomVO> => {
  return request({
    url: '/dormitory/buildingFloorRoom/' + id,
    method: 'get'
  });
};

/**
 * 新增宿舍楼-楼层-宿舍
 * @param data
 */
export const addBuildingFloorRoom = (data: BuildingFloorRoomForm) => {
  return request({
    url: '/dormitory/buildingFloorRoom',
    method: 'post',
    data: data
  });
};

/**
 * 修改宿舍楼-楼层-宿舍
 * @param data
 */
export const updateBuildingFloorRoom = (data: BuildingFloorRoomForm) => {
  return request({
    url: '/dormitory/buildingFloorRoom',
    method: 'put',
    data: data
  });
};

/**
 * 删除宿舍楼-楼层-宿舍
 * @param id
 */
export const delBuildingFloorRoom = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dormitory/buildingFloorRoom/' + id,
    method: 'delete'
  });
};
